# Contributor: Iztok Fister, Jr. <iztok@iztok-jr-fister.eu>
# Maintainer: Iztok Fister, Jr. <iztok@iztok-jr-fister.eu>
pkgname=py3-louvain
_pkgorig=python-louvain
pkgver=0.16
pkgrel=4
pkgdesc="Louvain community detection method"
url="https://github.com/taynaud/python-louvain"
arch="noarch"
license="BSD-3-Clause"
depends="python3 py3-networkx py3-numpy"
makedepends="py3-gpep517 py3-setuptools py3-wheel"
checkdepends="py3-pytest-xdist"
subpackages="$pkgname-pyc"
source="https://github.com/taynaud/python-louvain/archive/$pkgver/$_pkgorig-$pkgver.tar.gz
	$pkgname-fix-test.patch::https://github.com/taynaud/python-louvain/commit/638804ae636dc65306900ef6518ca0a1c9202566.patch
	$pkgname-int-division-in-tests.patch::https://github.com/taynaud/python-louvain/commit/def91793772c3e77ab4167d175903a5365c24b4b.patch
	"
builddir="$srcdir/$_pkgorig-$pkgver"

build() {
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	.testenv/bin/python3 -m installer .dist/*.whl
	.testenv/bin/python3 -m pytest -n auto
}

package() {
	python3 -m installer -d "$pkgdir" \
		.dist/*.whl
}

sha512sums="
471fa269a89e32333a55ae0b214b32388b0c0e5eff940907d8ff280839857eafd12de1a3121fa8fa83426c70eaca987fd4dcf9bf2086a605a72aa39e2edcf950  python-louvain-0.16.tar.gz
4cfb615ece9e27cc8d7b28db841fcd7417b565ba72e5a2d508afdb726615cdf7d409033b36419d6168210151f987718a7bdfd80db3bcabd27a8d2a692d82d190  py3-louvain-fix-test.patch
a49fcdf92a71ae85eb8d9972d5701759bcb8a95fc6723759e4071e46f2457995c13a2a47e69a867f2d9051f998088bac87e457673d864e3bfc8f38d6dc03f840  py3-louvain-int-division-in-tests.patch
"
